import { ResultSetHeader, RowDataPacket } from "mysql2";
import { pool } from "./000_pool";

pool.query<ResultSetHeader>('INSERT INTO user(name, age) VALUES ("Josh", 19), ("Page", 45)')
    .then(([resutl, fields]) => {
        console.log('---------------------------1');
        console.log(resutl);
        console.log(fields)
    })


pool.query<ResultSetHeader[]>(`
    INSERT INTO user(name, age) VALUES ("Josh", 19);
    INSERT INTO user(name, age) VALUES ("Page", 45);
    `)
    .then(([results]) => {
        console.log('--------------------------2');
        for (const result of results) {
            console.log(result);
        }


    })

pool.execute<ResultSetHeader>('INSERT INTO user(name, age) VALUES (?, ?), (?, ?)', ['Josh', 19, 'Page', 45])
    .then(([resutl, fields]) => {
        console.log('---------------------------3');
        console.log(resutl);
        console.log(fields)
    })

    
setTimeout(() => {
    pool.end()
}, 2000);

